<?php
class TBB_View_Helper_PanelLink extends Zend_View_Helper_Abstract
{
	public function panelLink($moduleName = 'customer')
	{
		$panelLink = "";
		$auth = Zend_Auth::getInstance();
		if($auth->hasIdentity()) {
			$identity = $auth->getIdentity();
			$username = $identity->username;
			$userModel = new TBB_Model_Users();
			$userID = $userModel->getUserIDByUsername($username);
			if($userModel->isAdminUser($userID)) {
				if($moduleName == 'customer') {
					$panelLink =  '<a class="span-4" href="admin/">Admin Panel</a>';
				} else if($moduleName == 'admin') {
					$panelLink = '<a class="span-4" href="/">Homepage</a>';
				}
			}
		}
		return $panelLink;
	}
}